package com.bsoft.gol.hcs.utils;

import hcn.util.BaseResponse;
import hcn.util.ResultCode;

/**
 * @Author:FangZhiyi
 * @Description
 * @Data Created in 2019/4/10 13:25
 * @Moddified By:
 */
public class BaseRespUtil {

    // 返回错误，可以传msg
    public static BaseResponse setResultError(String msg) {
        return setResult(ResultCode.ERROR, msg, null);
    }

    // 返回成功，可以传data值
    public static BaseResponse setResultSuccess(Object data) {
        return setResult(ResultCode.SUCCESS, null, data);
    }

    // 返回成功，沒有data值
    public static BaseResponse setResultSuccess() {
        return setResult(ResultCode.SUCCESS, null, null);
    }

    // 返回成功，沒有data值
    public static  BaseResponse setResultSuccess(String msg) {
        return setResult(ResultCode.SUCCESS, msg, null);
    }

    // 通用封装
    public static BaseResponse setResult(int code, String msg, Object data) {
        return new BaseResponse(code, msg, data);
    }
}
